package com.acme.bankapp.domain.bank;

public class SavingAccount extends AbstractAccount {

	public SavingAccount(double amount) {
		super(amount);
	}

	@Override
	public void deposit(final double amount) {
		if (amount < 0) {
			throw new IllegalArgumentException(NEGATIVE_VALUE);
		}
		setBalance(balance + amount);
	}

	@Override
	public void withdraw(final double amount) {
		if (amount > balance) {
			throw new IllegalArgumentException(NOT_ENOUGH_FOUNDS);
		}
		setBalance(balance - amount);
	}

	@Override
	public double maximumAmountTowothdraw() {
		return getBalance();
	}

}
